import request from '../../utils/request.js';
import PostCard from '../../components/common/PostCard.js';

export default {
  name: 'Profile',
  components: {
    PostCard
  },
  data() {
    return {
      userInfo: null,
      avatarData: null,
      hasAvatar: false,
      posts: [],
      postDialogVisible: false,
      postForm: {
        title: '',
        content: '',
        image_url: ''
      }
    };
  },
  computed: {
    genderText() {
      const genderMap = { 0: '保密', 1: '男', 2: '女' };
      return genderMap[this.userInfo?.gender || 0];
    }
  },
  methods: {
    async loadUserInfo() {
      try {
        const data = await request('/api/users/me');
        this.userInfo = data;
      } catch (error) {
        this.$message.error('获取用户信息失败');
      }
    },
    // ... 其他方法
  },
  mounted() {
    this.loadUserInfo();
    this.loadAvatarInfo();
    this.loadUserPosts();
  }
}; 